package com.mbc.hr.entities;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.io.Serializable;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

@SuppressWarnings("serial")
@Entity
@Table(name="HR_CalendarEvent")
@NamedQueries({
	@NamedQuery(name="CalendarEvent.findAll",query="SELECT ce, cp.editable FROM CalendarEventParticipant cp, CalendarEvent ce WHERE ce.eventID = cp.eventID AND ((ce.startDateTime >= :startDate and ce.startDateTime <= :endDate) OR (ce.endDateTime >= :startDate and ce.endDateTime <= :endDate)) and cp.userId = :createdBy")
})
public class CalendarEvent implements Serializable {

	@Id
	private Long eventID;
	private Long createdBy;
	private String eventName;
	private Date startDateTime;
	private Date endDateTime;
	private String backgroundColor;
	private String description;
	private byte eventType;
	private boolean editable;
	
	@Transient
	private List<CalendarEventReminder> reminders = new ArrayList<CalendarEventReminder>();
	@Transient
	private List<CalendarEventParticipant> participants = new ArrayList<CalendarEventParticipant>();

	public Long getEventID(){
		return eventID;
	}

	public void setEventID(Long eventID){
		this.eventID = eventID;
	}

	public Long getCreatedBy(){
		return createdBy;
	}

	public void setCreatedBy(Long createdBy){
		this.createdBy = createdBy;
	}

	public String getEventName(){
		return eventName;
	}

	public void setEventName(String eventName){
		this.eventName = eventName;
	}

	public Date getStartDateTime(){
		return startDateTime;
	}

	public void setStartDateTime(Date startDateTime){
		this.startDateTime = startDateTime;
	}

	public Date getEndDateTime(){
		return endDateTime;
	}

	public void setEndDateTime(Date endDateTime){
		this.endDateTime = endDateTime;
	}

	public String getBackgroundColor(){
		return backgroundColor;
	}

	public void setBackgroundColor(String backgroundColor){
		this.backgroundColor = backgroundColor;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public byte getEventType() {
		return eventType;
	}

	public void setEventType(byte eventType) {
		this.eventType = eventType;
	}

	public boolean isEditable() {
		return editable;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	public List<CalendarEventReminder> getReminders() {
		return reminders;
	}

	public void setReminders(List<CalendarEventReminder> reminders) {
		this.reminders = reminders;
	}

	public List<CalendarEventParticipant> getParticipants() {
		return participants;
	}

	public void setParticipants(List<CalendarEventParticipant> participants) {
		this.participants = participants;
	}


}
